Skip to content

Potential fix for code scanning alert no. 5: Workflow does not contain permissions#35

Merged
nstarman merged 1 commit into
mainfrom
alert-autofix-5
Oct 6, 2025
Merged

Potential fix for code scanning alert no. 5: Workflow does not contain permissions#35
nstarman merged 1 commit into
mainfrom
alert-autofix-5

Conversation

@nstarman
Copy link
Copy Markdown
Contributor

@nstarman nstarman commented Oct 6, 2025

Potential fix for https://github.com/GalacticDynamics/optional_dependencies/security/code-scanning/5

To fix the issue, you should set explicit permissions for the GITHUB_TOKEN either at the workflow root level or per job. For this case, since the flagged job is pre-commit, and it only needs read access, you can add a permissions block under that job. The minimal set would be contents: read, preventing write access while allowing code checkout and local analysis. No functionality will change; rather, it will make the workflow more secure.

Edit .github/workflows/ci.yml; under the pre-commit job (after runs-on: ubuntu-latest), insert the explicit permissions block:

permissions:
  contents: read

No imports or extra methods are needed.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (00ebabc) to head (20da85d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #35   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           82        82           
=========================================
  Hits            82        82           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nstarman nstarman added this to the v0.5.0 milestone Oct 6, 2025
@nstarman nstarman marked this pull request as ready for review October 6, 2025 22:11
@nstarman nstarman merged commit 35d6b48 into main Oct 6, 2025
18 checks passed
@nstarman nstarman deleted the alert-autofix-5 branch October 6, 2025 22:13
@nstarman nstarman modified the milestones: v0.5.0, v0.4.x Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant